#ifndef EVM_OPCODE_H
#define EVM_OPCODE_H

enum opcode {
    NOP = 0,

    PUSH, // 5-byte command
    POP,
    LOAD,
    STORE,

    PUSHARG,

    LDARG, // 5-byte?
    STARG, // 5-byte

    ADD,
    SUB,
    MUL,
    DIV,
    MOD,

    LADD,
    LSUB,
    LMUL,
    LDIV,
    LMOD,

    VADD,
    VSUB,
    VMUL,
    VDIV,
    VMOD,

    LOR,
    LAND,
    LXOR,
    LNOT,

    VOR,
    VAND,
    VXOR,
    VNOT,

    CMP,

    JE,
    JNE,
    JG,
    JGE,
    JL,
    JLE,
    JZ,
    JNZ,

    JMP,

    CALL,
    RET,

    SIZEOF,// ... object => ... object size-of-object
    NEW,   // ... class  => ... object
    FREE,  // ... object => ...
    MCALL, // ... object method => ... [result]+

    FORK,    // ... name function => ... process_id
    SUSPEND, // ... process_id => ...
    STOP,    // ... process_id => ...
    WAKEUP,  // ... process_id => ...
    SLEEP,   // ... ms => ...

    IN,
    OUT,

    NLOAD,
    NSTORE,

    NLOADLIB,
    NUNLOADLIB,
    NPROCADDR,
    NCALL,

    DBGDATA,
    DBGCALL,
    DBGARGS
};

typedef struct evm_command {
    uint8_t opcode : 7;
    uint8_t arg    : 1;
} evm_command;

#endif // EVM_OPCODE_H
